package lab03.test13;

import java.sql.*;

public class Test13 {
    public static void main(String[] args) {

        Connection connection = null;
        Statement statement = null;
        ResultSet resultSet = null;

        try {
            Class.forName("com.mysql.jdbc.Driver");
            connection = DriverManager.getConnection(
                    "jdbc:mysql://localhost:3306/java_2017?serverTimezone=UTC",
                    "root",
                    "123"
            );
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        try {
            statement=connection.createStatement();

        statement.execute("create table  t_students(id bigint(20)," +
                "stu_no varchar(50)PRIMARY KEY,real_name varchar(50) ," +
                "age tinyint(4),gender tinyint(4),department varchar(50))");

        statement.executeUpdate("INSERT INTO t_students(id,stu_no,real_name,age,gender,department)" +
                " VALUES(1,'1606101002','xiaolin',20,0,'信息与工程学院') ");
        statement.executeUpdate("INSERT INTO t_students(id,stu_no,real_name,age,gender,department)" +
                " VALUES(1,'1606101003','xiaolin',20,1,'信息与工程学院') ");
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }

}
